package com.sky.config;

import com.sky.properties.AliOssProperties;
import com.sky.utils.AliOssUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName: OssConfigurarion
 * Description:用于创建阿里ossutils
 *
 * @Author HTAO
 * @Create 2023/11/1 21:31
 */
@Configuration
@Slf4j
public class OssConfigurarion {


    @Bean
    public AliOssUtil ailiOssUtil(AliOssProperties aliOssProperties){
        log.info("开始创建阿里对象");
        return AliOssUtil.builder()
                .endpoint(aliOssProperties.getEndpoint())
                .accessKeyId(aliOssProperties.getAccessKeyId())
                .accessKeySecret(aliOssProperties.getAccessKeySecret())
                .bucketName(aliOssProperties.getBucketName())
                .build();

    }

}
